﻿namespace demo6
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入数字: ");
            string userInput = Console.ReadLine();
            
            try
            {
                // 开始转换用户输入的字符串为整形数值  
                int convertedNumber = int.Parse(userInput.Trim());
                var valRes = convertedNumber + 1;
                Console.WriteLine("转换为int成功: " + convertedNumber);
            }
            catch (Exception ex)
            {
                // 捕获未知的其他错误
                Console.WriteLine("未知错误类型: " + ex.Message);
                Console.WriteLine("未知错误Stack: " + ex.StackTrace);
            }
            finally
            {

                Console.WriteLine("结束操作");
            }
        }
    }
}
